<?php
/**
 * Created by litong on Date: 2019/2/24 0024 下午 8:39
 */
$host="localhost";
$username="root";
$password="";
$dbname="php_study";

$connection = mysqli_connect($host, $username, $password,$dbname);
if(!$connection){
  die("连接数据库失败".mysqli_connect_error().PHP_EOL);
}
$sql = "CREATE TABLE my_guests(id INT(6) AUTO_INCREMENT PRIMARY KEY,firstname VARCHAR(30) NOT NULL,
lastname VARCHAR(30) NOT NULL,email VARCHAR(50),reg_date TIMESTAMP);";

if(mysqli_query($connection,$sql)){
  echo "表创建成功".PHP_EOL;
}else{
  echo "表创建失败:".mysqli_error($connection).PHP_EOL;
}
